 package server.commands;

 import client.MapleCharacter;
 import client.MapleClient;
 import client.MapleStat;
 import client.inventory.Item;
 import client.inventory.MapleInventoryType;
 import configs.ServerConfig;
 import constants.ItemConstants;
 import constants.JobConstants;
 import constants.ServerConstants;
 import handling.channel.handler.InterServerHandler;
 import java.util.Collections;
 import java.util.List;
 import scripting.item.ItemScriptManager;
 import scripting.npc.NPCScriptManager;
 import scripting.quest.QuestScriptManager;
 import server.MapleInventoryManipulator;
 import server.RankingWorker;
 import server.life.MapleMonster;
 import server.maps.MapleMap;
 import server.maps.MapleMapObject;
 import server.maps.MapleMapObjectType;
 import server.maps.SavedLocationType;
 import tools.MaplePacketCreator;
 import tools.StringUtil;
 import tools.packet.UIPacket;










 public class PlayerCommand
 {
   public static PlayerGMRank getPlayerLevelRequired() {
/*  41 */     return PlayerGMRank.NORMAL;
   }






   public static class STR
     extends DistributeStatCommands {}






   public static class DEX
     extends DistributeStatCommands {}






   public static class INT
     extends DistributeStatCommands {}






   public static class LUK
     extends DistributeStatCommands {}






   public static abstract class DistributeStatCommands
     extends CommandExecute
   {
/*  84 */     protected MapleStat stat = null;

     private void setStat(MapleCharacter player, int amount) {
/*  87 */       switch (this.stat) {
         case 力量:
/*  89 */           player.getStat().setStr((short)amount, player);
/*  90 */           player.updateSingleStat(MapleStat.力量, player.getStat().getStr());
           break;
         case 敏捷:
/*  93 */           player.getStat().setDex((short)amount, player);
/*  94 */           player.updateSingleStat(MapleStat.敏捷, player.getStat().getDex());
           break;
         case 智力:
/*  97 */           player.getStat().setInt((short)amount, player);
/*  98 */           player.updateSingleStat(MapleStat.智力, player.getStat().getInt());
           break;
         case 运气:
/* 101 */           player.getStat().setLuk((short)amount, player);
/* 102 */           player.updateSingleStat(MapleStat.运气, player.getStat().getLuk());
           break;
       }
     }

     private int getStat(MapleCharacter player) {
/* 108 */       switch (this.stat) {
         case 力量:
/* 110 */           return player.getStat().getStr();
         case 敏捷:
/* 112 */           return player.getStat().getDex();
         case 智力:
/* 114 */           return player.getStat().getInt();
         case 运气:
/* 116 */           return player.getStat().getLuk();
       }
/* 118 */       throw new RuntimeException();
     }


     public int execute(MapleClient c, String[] splitted) {
       int change;
/* 124 */       if (splitted.length < 2) {
/* 125 */         c.getPlayer().dropMessage(5, "输入的数字无效.");
/* 126 */         return 0;
       }

       try {
/* 130 */         change = Integer.parseInt(splitted[1]);
/* 131 */       } catch (NumberFormatException nfe) {
/* 132 */         c.getPlayer().dropMessage(5, "输入的数字无效.");
/* 133 */         return 0;
       }
/* 135 */       if (change <= 0) {
/* 136 */         c.getPlayer().dropMessage(5, "您必须输入一个大于 0 的数字.");
/* 137 */         return 0;
       }
/* 139 */       if (c.getPlayer().getRemainingAp() < change) {
/* 140 */         c.getPlayer().dropMessage(5, "您的能力点不足.");
/* 141 */         return 0;
       }
/* 143 */       if (getStat(c.getPlayer()) + change > ServerConfig.CHANNEL_PLAYER_MAXAP) {
/* 144 */         c.getPlayer().dropMessage(5, "所要分配的能力点总和不能大于 " + ServerConfig.CHANNEL_PLAYER_MAXAP + " 点.");
/* 145 */         return 0;
       }
/* 147 */       setStat(c.getPlayer(), getStat(c.getPlayer()) + change);
/* 148 */       c.getPlayer().setRemainingAp((short)(c.getPlayer().getRemainingAp() - change));
/* 149 */       c.getPlayer().updateSingleStat(MapleStat.AVAILABLEAP, c.getPlayer().getRemainingAp());
/* 150 */       c.getPlayer().dropMessage(5, "加点成功您的 " + StringUtil.makeEnumHumanReadable(this.stat.name()) + " 提高了 " + change + " 点.");
/* 151 */       return 1;
     }
   }



























   public static class Fh
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 185 */       int reliveCount = ServerConfig.CHANNEL_PLAYER_RESUFREECOUNT;
/* 186 */       int reliveCost = ServerConfig.CHANNEL_PLAYER_RESUNEEDMESO;
/* 187 */       boolean usemPoints = (reliveCost <= 10000);
/* 188 */       boolean canRelive = false;
/* 189 */       if (c.getPlayer().getLevel() < 70) {
/* 190 */         c.getPlayer().dropMessage(5, "等级达到70级才可以使用这个命令.");
/* 191 */         return 0;
       }
/* 193 */       if (c.getPlayer().isAlive()) {
/* 194 */         c.getPlayer().dropMessage(5, "您都还没有挂掉，怎么能使用这个命令呢。");
/* 195 */         return 0;
       }
/* 197 */       if (c.getPlayer().getBossLog("原地复活") >= reliveCount) {
/* 198 */         if (usemPoints) {
/* 199 */           canRelive = (c.getPlayer().getCSPoints(2) > reliveCost);
         } else {
/* 201 */           canRelive = (c.getPlayer().getMeso() > reliveCost);
         }
       } else {
/* 204 */         canRelive = true;
       }
/* 206 */       if (!canRelive) {
/* 207 */         c.getPlayer().dropMessage(5, "您今天的免费复活次数已经用完或者您的" + (usemPoints ? "抵用券" : "金币") + "不足" + reliveCost);
/* 208 */         return 0;
       }
/* 210 */       String message = "恭喜您原地复活成功，";
/* 211 */       if (c.getPlayer().getBossLog("原地复活") < reliveCount) {
/* 212 */         message = message + "您今天还可以免费使用: " + (reliveCount - c.getPlayer().getBossLog("原地复活")) + " 次。";
/* 213 */         c.getPlayer().setBossLog("原地复活");
       } else {
/* 215 */         message = message + "本次复活花费 " + reliveCost + (usemPoints ? " 抵用券" : " 金币");
/* 216 */         if (usemPoints) {
/* 217 */           c.getPlayer().modifyCSPoints(2, -reliveCost);
         } else {
/* 219 */           c.getPlayer().gainMeso(-reliveCost, true);
         }
       }
/* 222 */       c.getPlayer().getStat().heal(c.getPlayer());
/* 223 */       c.getPlayer().dispelDebuffs();

/* 225 */       c.getPlayer().setStance(0);


/* 228 */       c.getPlayer().dropMessage(5, message);
/* 229 */       return 0;
     }
   }





















   public static class vipFH
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 257 */       return 0;
     }
   }





   public static class Mob
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 269 */       MapleMonster mob = null;
/* 270 */       for (MapleMapObject monstermo : c.getPlayer().getMap().getMapObjectsInRange(c.getPlayer().getPosition(), 100000.0D, Collections.singletonList(MapleMapObjectType.MONSTER))) {
/* 271 */         mob = (MapleMonster)monstermo;
/* 272 */         if (mob.isAlive()) {
/* 273 */           c.getPlayer().dropMessage(6, "怪物: " + mob.toString());
           break;
         }
       }
/* 277 */       if (mob == null) {
/* 278 */         c.getPlayer().dropMessage(6, "查看失败: 1.没有找到需要查看的怪物信息. 2.你周围没有怪物出现. 3.有些怪物禁止查看.");
       }
/* 280 */       return 1;
     }
   }

   public static class drop
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 288 */       c.removeClickedNPC();
/* 289 */       NPCScriptManager.getInstance().start(c, 1530635, "6");
/* 290 */       return 1;
     }
   }






   public static class FM
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 303 */       if (ServerConstants.isBlockedMapFM(c.getPlayer().getMapId())) {
/* 304 */         c.getPlayer().dropMessage(5, "当前地图禁止使用此命令.");
/* 305 */         return 0;
       }
/* 307 */       if (c.getPlayer().getLevel() < 10 && c.getPlayer().getJob() != 200) {
/* 308 */         c.getPlayer().dropMessage(5, "等级达到10级才可以使用此命令.");
/* 309 */         return 0;
       }
/* 311 */       if (c.getPlayer().hasBlockedInventory() || c.getPlayer().getMap().getSquadByMap() != null || c.getPlayer().getEventInstance() != null || c.getPlayer().getMap().getEMByMap() != null || c.getPlayer().getMapId() >= 990000000) {
/* 312 */         c.getPlayer().dropMessage(5, "当前地图禁止使用此命令.");
/* 313 */         return 0;
       }
/* 315 */       if ((c.getPlayer().getMapId() >= 680000210 && c.getPlayer().getMapId() <= 680000502) || (c.getPlayer().getMapId() / 1000 == 980000 && c.getPlayer().getMapId() != 980000000) || c.getPlayer().getMapId() / 100 == 1030008 || c.getPlayer().getMapId() / 100 == 922010 || c.getPlayer().getMapId() / 10 == 13003000) {
/* 316 */         c.getPlayer().dropMessage(5, "当前地图禁止使用此命令.");
/* 317 */         return 0;
       }
/* 319 */       c.getPlayer().saveLocation(SavedLocationType.FREE_MARKET, c.getPlayer().getMap().getReturnMap().getId());
/* 320 */       MapleMap map = c.getChannelServer().getMapFactory().getMap(910000000);
/* 321 */       c.getPlayer().changeMap(map, map.getPortal(0));
/* 322 */       return 1;
     }
   }


   public static class PM
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 331 */       InterServerHandler.EnterMTS(c, c.getPlayer());
/* 332 */       return 1;
     }
   }






   public static class EA
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 345 */       c.removeClickedNPC();
/* 346 */       NPCScriptManager.getInstance().dispose(c);
/* 347 */       ItemScriptManager.getInstance().dispose(c);
/* 348 */       QuestScriptManager.getInstance().dispose(c);
/* 349 */       c.announce(MaplePacketCreator.enableActions());
/* 350 */       c.getPlayer().dropMessage(5, "解卡操作成功.");
/* 351 */       return 1;
     }
   }






   public static class Ranking
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 364 */       if (splitted.length < 4) {
/* 365 */         c.getPlayer().dropMessage(5, "使用 @ranking [职业类型] [起始排名] [结束排名] 例子:[@ranking 所有 1 20]此为显示所有职业排名第1-20的信息");
/* 366 */         StringBuilder builder = new StringBuilder("职业类型: ");
/* 367 */         for (String b : RankingWorker.getJobCommands().keySet()) {
/* 368 */           builder.append(b);
/* 369 */           builder.append(" ");
         }
/* 371 */         c.getPlayer().dropMessage(5, builder.toString());
       } else {
/* 373 */         int start = 1, end = 20;
         try {
/* 375 */           start = Integer.parseInt(splitted[2]);
/* 376 */           end = Integer.parseInt(splitted[3]);
/* 377 */         } catch (NumberFormatException e) {
/* 378 */           c.getPlayer().dropMessage(5, "输入的显示排名数字错误.每次只能显示20个角色的信息 例子:[@ranking 所有 1 20");
         }
/* 380 */         if (end < start || end - start > 20) {
/* 381 */           c.getPlayer().dropMessage(5, "输入的显示排名数字错误.每次只能显示20个角色的信息 例子:[@ranking 所有 1 20");
         } else {
/* 383 */           Integer job = RankingWorker.getJobCommand(splitted[1]);
/* 384 */           if (job == null) {
/* 385 */             c.getPlayer().dropMessage(5, "输入的职业类型代码不存在.");
           } else {
/* 387 */             List<RankingWorker.RankingInformation> ranks = RankingWorker.getRankingInfo(job.intValue());
/* 388 */             if (ranks == null || ranks.size() <= 0) {
/* 389 */               c.getPlayer().dropMessage(5, "请稍后在试.");
             } else {
/* 391 */               int num = 0;
/* 392 */               for (RankingWorker.RankingInformation rank : ranks) {
/* 393 */                 if (rank.rank >= start && rank.rank <= end) {
/* 394 */                   if (num == 0) {
/* 395 */                     c.getPlayer().dropMessage(6, "当前显示为 " + splitted[1] + " 的排名 - 开始 " + start + " 结束 " + end);
/* 396 */                     c.getPlayer().dropMessage(6, "--------------------------------------------");
                   }
/* 398 */                   c.getPlayer().dropMessage(6, rank.toString());
/* 399 */                   num++;
                 }
               }
/* 402 */               if (num == 0) {
/* 403 */                 c.getPlayer().dropMessage(5, "排名信息为空.");
               }
             }
           }
         }
       }
/* 409 */       return 1;
     }
   }






   public static class EBBox
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 422 */       if (splitted.length < 2) {
/* 423 */         c.getPlayer().dropMessage(6, "用法: @穿戴宝盒 [宝盒在装备拦的位置]");
/* 424 */         return 0;
       }
/* 426 */       if (c.getPlayer().getLevel() < 10) {
/* 427 */         c.getPlayer().dropMessage(5, "等级达到10级才可以使用此命令.");
/* 428 */         return 0;
       }
/* 430 */       if (JobConstants.is龙的传人(c.getPlayer().getJob())) {
/* 431 */         short src = (short)Integer.parseInt(splitted[1]);
/* 432 */         Item toUse = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem(src);
/* 433 */         if (toUse == null || toUse.getQuantity() < 1 || !ItemConstants.is龙传宝盒(toUse.getItemId())) {
/* 434 */           c.getPlayer().dropMessage(6, "穿戴错误，装备栏的第 " + src + " 个道具的道具信息为空，或者该道具不是宝盒装备。");
/* 435 */           return 0;
         }
/* 437 */         MapleInventoryManipulator.equip(c, src, (short)-10);
/* 438 */         return 1;
       }
/* 440 */       c.getPlayer().dropMessage(6, "此命令只对龙的传人开放。");
/* 441 */       return 0;
     }
   }


   public static class EB
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 450 */       if (splitted.length < 2) {
/* 451 */         c.getPlayer().dropMessage(6, "用法: @EB [副手在装备拦的位置]");
/* 452 */         return 0;
       }
/* 454 */       if (c.getPlayer().getLevel() < 10) {
/* 455 */         c.getPlayer().dropMessage(5, "等级达到10级才可以使用此命令.");
/* 456 */         return 0;
       }

/* 459 */       short src = (short)Integer.parseInt(splitted[1]);
/* 460 */       Item toUse = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem(src);
/* 461 */       if (toUse == null || toUse.getQuantity() < 1) {
/* 462 */         c.getPlayer().dropMessage(6, "穿戴错误，装备栏的第 " + src + " 个道具的道具信息为空，或者该道具不是宝盒装备。");
/* 463 */         return 0;
       }
/* 465 */       MapleInventoryManipulator.equip(c, src, (short)-10);
/* 466 */       return 1;
     }
   }


















   public static class UEB
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 491 */       Item toUse = c.getPlayer().getInventory(MapleInventoryType.EQUIPPED).getItem((short)-10);
/* 492 */       if (toUse == null || c.getPlayer().getInventory(MapleInventoryType.EQUIP).isFull()) {
/* 493 */         c.getPlayer().dropMessage(6, "副武器位置道具信息为空，或者装备栏已满。");
/* 494 */         return 0;
       }
/* 496 */       MapleInventoryManipulator.unequip(c, (short)-10, c.getPlayer().getInventory(MapleInventoryType.EQUIP).getNextFreeSlot());
/* 497 */       return 1;
     }
   }







   public static class DS
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 511 */       if (JobConstants.is恶魔(c.getPlayer().getJob())) {
/* 512 */         Item toRemove = c.getPlayer().getInventory(MapleInventoryType.EQUIPPED).getItem((short)-10);
/* 513 */         if (toRemove != null && toRemove.getItemId() / 1000 == 1099 && toRemove.getItemId() != 1099004 && toRemove.getItemId() != 1099005 && toRemove.getItemId() != 1099009) {
/* 514 */           MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.EQUIPPED, toRemove.getPosition(), toRemove.getQuantity(), false);
/* 515 */           c.getPlayer().equipChanged();
/* 516 */           return 1;
         }
/* 518 */         c.getPlayer().dropMessage(6, "删除盾牌失败，盾牌位置道具信息为空.或者该盾牌可以手动取下来.");
/* 519 */         return 0;
       }

/* 522 */       c.getPlayer().dropMessage(6, "此命令只对恶魔职业开放。");
/* 523 */       return 0;
     }
   }



   public static class MF
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 533 */       c.announce(UIPacket.sendOpenWindow(596));
/* 534 */       return 1;
     }
   }




















   public static class Help
     extends CommandExecute
   {
     public int execute(MapleClient c, String[] splitted) {
/* 561 */       String text = "             #fnNanum Gothic ExtraBold##e#fs16##b欢迎来到#r" + c.getChannelServer().getServerName() + "#fs##k\r\n\r\n";
/* 562 */       text = text + "#e#b我是本服的玩家命令帮助管理员\r\n";
/* 563 */       text = text + "#e#b以下为本服的玩家命令 <>代表命令后需要跟随的数值#k\r\n\r\n";
/* 564 */       text = text + "@str, @dex, @int, @luk <需要分配的点数>\r\n\r\n";
/* 565 */       text = text + "@mob (查看当前离你最近的怪物信息)\r\n\r\n";
/* 566 */       text = text + "@drop (查看当前地图的怪物爆率)\r\n\r\n";
/* 567 */       text = text + "@fm (移动到自由市场)\r\n\r\n";
/* 568 */       text = text + "@pm (打开万能NPC界面)\r\n\r\n";
/* 569 */       text = text + "@ea (解卡-如果无法和NPC进行对话请输入这个命令)\r\n\r\n";
/* 570 */       text = text + "@fh (复活-每日可以免费复活5次)\r\n\r\n";
/* 571 */       text = text + "@ranking (查看游戏中的排名信息)\r\n\r\n";
/* 572 */       text = text + "@ebbox <宝盒在装备拦的位置-限制龙的传人使用>\r\n\r\n";
/* 573 */       text = text + "@eb <装备在装备拦的位置>\r\n\r\n";
/* 574 */       text = text + "@ueb (取下副手)\r\n\r\n";
/* 575 */       text = text + "@ds (删除恶魔猎手盾牌-限制恶魔猎手使用)\r\n\r\n";
/* 576 */       text = text + "@mf (打开怪怪系统界面)";















/* 592 */       c.announce(MaplePacketCreator.sendPolice(text));
/* 593 */       return 1;
     }
   }
 }


/* Location:              C:\PGX\Server.jar!\server\commands\PlayerCommand.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */